package com.raising.framework.controller;

import com.raising.framework.dao.ICrudDao;
import com.raising.framework.entity.BaseEntity;
import com.raising.framework.service.CrudService;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * 基础controller
 * @author GaoYuan
 */
public abstract class CrudController<S extends CrudService<D,T>, D extends ICrudDao<T>, T extends BaseEntity<T>> extends BaseController {
    @Autowired
    protected S service;
//
//    @ApiOperation(value = "分页列出")
//    @RequestMapping(value = "page",method = RequestMethod.POST)
//    @UseSecurity
//    public Response page(Page<T> page, T t) {
//        page.setEntity(t);
//        return new Response().success(service.findPage(page));
//    }
//
//    @ApiOperation(value = "新建对象")
//    @RequestMapping(value = "insert",method = RequestMethod.POST)
//    @UseSecurity
//    public Response insert(T t) {
//        return new Response().success(service.save(t));
//    }
//
//    @ApiOperation(value = "获取详情")
//    @RequestMapping(value = "get",method = RequestMethod.GET)
//    @UseSecurity
//    public Response get(String id) {
//        return new Response().success(service.get(id));
//    }
//
//    @ApiOperation(value = "更新全部")
//    @RequestMapping(value = "update",method = RequestMethod.POST)
//    @UseSecurity
//    public Response update(T t) {
//        return new Response().success(service.save(t));
//    }
//
//    @ApiOperation(value = "更新部分")
//    @RequestMapping(value = "updateS",method = RequestMethod.POST)
//    @UseSecurity
//    public Response updatePatch(T t) {
//        return new Response().success(service.save(t));
//    }
//
//    @ApiOperation(value = "删除对象")
//    @RequestMapping(value = "delete",method = RequestMethod.POST)
//    @UseSecurity
//    public Response delete(String id) {
//        return new Response().success(service.delete(id));
//    }

}
